package com.bdweb.dao;

import com.bdweb.model.POWER;
import com.bdweb.model.USER;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface powerDao {

    @Select("select * from bd_power")
    List<POWER> findAll();
    @Select("select * from bd_power where powerName=#{powerName} and isopen=#{isopen} and ip=#{ip}  and port=#{port} and codeopen=#{codeopen}  and codeclose=#{codeclose} " )
    POWER findByNameAndPwd(@Param("powerName") String powerName, @Param("isopen") Boolean isopen , @Param("ip") String ip ,@Param("port") String port , @Param("codeopen") String codeopen ,@Param("codeclose") String codeclose );
    @Insert("insert into bd_power values(#{id}, #{powerName}, #{isopen} , #{ip} , #{port}),#{codeopen} , #{codeclose}")
    Integer addByPower(POWER power);
    @Delete("delete from bd_power where id=#{id}")
    Integer deletePowerById(Integer id);
    @Update("update bd_power set username=#{powerName}, isopen=#{isopen}, where id=#{id},ip=#{ip},port=#{port} ,codeopen=#{codeopen},codeclose=#{codeclose}")
    Integer updateNameAndPwdById(@Param("id") Integer id, @Param("powerName") String name, @Param("isopen") Boolean isopen ,@Param("ip") String ip ,@Param("port") String post ,@Param("codeopen") String codeopen ,@Param("codeclose") String codeclose);



}
